import { BrowserRouter, Routes, Route } from "react-router-dom";
import { Home } from "./page/home";

import React, { lazy, Suspense } from "react";
import { Spin } from "antd";

// 懒加载
const ResumeGen = lazy(() =>
    import('./page/resume-gen/resume-gen').then(m => ({default: m.ResumeGen})))

// const Home = lazy(() =>
//     import('./page/home').then(m => ({default: m.Home}))
// )

const Loading: React.FC = () => {
    return <div style={{height: '100vh', display: "flex", alignItems: 'center', justifyContent: 'center'}}>
        <Spin tip={'Loading'} size={"large"}>
        </Spin>
    </div>
}

function App() {

    return <>
        <BrowserRouter>
            <Suspense fallback={
                <Loading/>
            }>
                <Routes>
                    <Route path={'/'} element={<Home/>}/>
                    <Route path={'/resume'} element={<ResumeGen/>}/>
                </Routes>
            </Suspense>
        </BrowserRouter>

    </>
}

export default App;
